<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    
    <p>This example demonstrates how to implement a simple Authenticator</p>
    
    <ui:fragment rendered="#{identity.loggedIn}">
        <div>Currently logged in as: <b>#{identity.user.id}</b></div>
        
        <h:form>
            <h:commandButton id="logout" value="Log out" action="#{identity.logout}"/>
        </h:form>
    </ui:fragment>
    
    <h:form id="loginForm" rendered="#{not identity.loggedIn}">
        <h:messages/>
        
        <div class="loginRow">
            <h:outputLabel for="name" value="Username" styleClass="loginLabel"/>
            <h:inputText id="name" value="#{credentials.username}"/>
        </div>
        
        <div class="loginRow">
            <h:outputLabel for="password" value="Password" styleClass="loginLabel"/>
            <h:inputSecret id="password" value="#{credentials.password}" redisplay="true"/>
        </div>
        
        <div class="loginRow">
            
        </div>
        
        <div class="buttons">
            <h:commandButton id="login" value="LOGIN" action="#{identity.login}" styleClass="loginButton"/>
        </div>
        
    </h:form>
    
    <br style="clear:both"/>
    
</html>